package yja.gzw.app.activity

import android.widget.Toast
import androidx.lifecycle.Observer
import com.bumptech.glide.Glide
import yja.gzw.app.R
import yja.gzw.app.base.BaseActivity
import yja.gzw.app.databinding.ActivityFankuchenggongBinding
import yja.gzw.app.model.UserData
import yja.gzw.app.viewmodel.Mainviewmodel

class FankuchenggongActivity :BaseActivity<Mainviewmodel, ActivityFankuchenggongBinding>(R.layout.activity_fankuchenggong){
    override fun initView() {

        val ids=intent.getStringExtra("id")

        viewmodel.onfankuixiangqingwang(UserData.token, mapOf("id" to ids!!))

    }

    override fun dataObservese() {
        viewmodel.onfankuixiangqing.observe(this, Observer {
            if(it.code==1){
                binding.zhuangtai.text=it.data.status_text
                binding.shijian.text=it.data.createtime_text
                binding.shijian2.text=it.data.createtime_text
                binding.zhuangtai2.text="您的问题"+it.data.status_text
                binding.leixing.text=it.data.name
                binding.neirong.text=it.data.content
              val imsgs=  it.data.images.split(",")

                Glide.with(this).load("http://117ai.32.hzgqapp.com/"+imsgs[0]).into(binding.tupian)




            }else{
                Toast.makeText(this,it.msg, Toast.LENGTH_SHORT).show()
            }

        })



    }
}